{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 第4周-聚类、降维、矩阵分解 \n",
    "问题描述\n",
    "根据活动的关键词（count_1, count_2, ..., count_100，count_other属性）做聚类，可采用KMeans聚类\n",
    "尝试K=10，20，30，..., 100, 并计算各自CH_scores。\n",
    "解题提示\n",
    "文件说明：\n",
    "1. 可以先运行0. EDA.ipynb，看一下竞赛所有数据的情况；\n",
    "2. 总体活动的数目太多（300w+记录），可以只需对训练集train.csv和测试集test.cv出现的活动（13418条记录）举行聚类即可。运行1. Users_Events.ipynb可得到只在训练集train.csv和测试集test.cv出现的活动，可自己修改代码存为csv格式，在进行聚类。\n",
    "批改标准\n",
    "1. 抽取出只在训练集和测试集中出现的event：20分\n",
    "2. 聚类 ：40分\n",
    "3. CH_scores计算：20分\n",
    "4. 结果显示/分析：20分"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （1） 导入相应的工具包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#导入必要的工具包\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.cluster import MiniBatchKMeans\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn import metrics\n",
    "\n",
    "from sklearn.decomposition import PCA\n",
    "import time\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （2）读取相应的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>event_id</th>\n",
       "      <th>user_id</th>\n",
       "      <th>start_time</th>\n",
       "      <th>city</th>\n",
       "      <th>state</th>\n",
       "      <th>zip</th>\n",
       "      <th>country</th>\n",
       "      <th>lat</th>\n",
       "      <th>lng</th>\n",
       "      <th>c_1</th>\n",
       "      <th>...</th>\n",
       "      <th>c_92</th>\n",
       "      <th>c_93</th>\n",
       "      <th>c_94</th>\n",
       "      <th>c_95</th>\n",
       "      <th>c_96</th>\n",
       "      <th>c_97</th>\n",
       "      <th>c_98</th>\n",
       "      <th>c_99</th>\n",
       "      <th>c_100</th>\n",
       "      <th>c_other</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>684921758</td>\n",
       "      <td>3647864012</td>\n",
       "      <td>2012-10-31T00:00:00.001Z</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>244999119</td>\n",
       "      <td>3476440521</td>\n",
       "      <td>2012-11-03T00:00:00.001Z</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3928440935</td>\n",
       "      <td>517514445</td>\n",
       "      <td>2012-11-05T00:00:00.001Z</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2582345152</td>\n",
       "      <td>781585781</td>\n",
       "      <td>2012-10-30T00:00:00.001Z</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1051165850</td>\n",
       "      <td>1016098580</td>\n",
       "      <td>2012-09-27T00:00:00.001Z</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 110 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     event_id     user_id                start_time city state  zip country  \\\n",
       "0   684921758  3647864012  2012-10-31T00:00:00.001Z  NaN   NaN  NaN     NaN   \n",
       "1   244999119  3476440521  2012-11-03T00:00:00.001Z  NaN   NaN  NaN     NaN   \n",
       "2  3928440935   517514445  2012-11-05T00:00:00.001Z  NaN   NaN  NaN     NaN   \n",
       "3  2582345152   781585781  2012-10-30T00:00:00.001Z  NaN   NaN  NaN     NaN   \n",
       "4  1051165850  1016098580  2012-09-27T00:00:00.001Z  NaN   NaN  NaN     NaN   \n",
       "\n",
       "   lat  lng  c_1   ...     c_92  c_93  c_94  c_95  c_96  c_97  c_98  c_99  \\\n",
       "0  NaN  NaN    2   ...        0     1     0     0     0     0     0     0   \n",
       "1  NaN  NaN    2   ...        0     0     0     0     0     0     0     0   \n",
       "2  NaN  NaN    0   ...        0     0     0     0     0     0     0     0   \n",
       "3  NaN  NaN    1   ...        0     0     0     0     0     0     0     0   \n",
       "4  NaN  NaN    1   ...        0     0     0     0     0     0     0     0   \n",
       "\n",
       "   c_100  c_other  \n",
       "0      0        9  \n",
       "1      0        7  \n",
       "2      0       12  \n",
       "3      0        8  \n",
       "4      0        9  \n",
       "\n",
       "[5 rows x 110 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#读取数据\n",
    "eventData = pd.read_csv(\"homework_event.csv\")\n",
    "eventData.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （3） 定义聚类，评价的方法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用 kmeans 进行聚类，由提示可得使用minibatchkmeans 比较好，评价参数使用轮廓系数，评分使用 CH_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 一个参数点（聚类数据为K）的模型，在校验集上评价聚类算法性能\n",
    "def K_cluster_analysis(K, x_data):\n",
    "    start = time.time()\n",
    "    \n",
    "    print(\"K-means begin with clusters: {}\".format(K));\n",
    "    \n",
    "    #K-means,在训练集上训练\n",
    "    mb_kmeans = MiniBatchKMeans(n_clusters = K)\n",
    "    mb_kmeans.fit(x_data)\n",
    "    \n",
    "    # K值的评估标准\n",
    "    #常见的方法有轮廓系数Silhouette Coefficient和Calinski-Harabasz Index\n",
    "    #这两个分数值越大则聚类效果越好\n",
    "    CH_score = metrics.silhouette_score(x_data,mb_kmeans.predict(x_data))\n",
    "    \n",
    "    \n",
    "    end = time.time()\n",
    "    print(\"CH_score: {}, time elaps:{}\".format(CH_score, int(end-start)))\n",
    "    \n",
    "    return CH_score"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （4） 丢掉不需要进行聚类的列，留下有用列"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "根据提示，只需要对count_1, count_2, ..., count_100，count_other做聚类就可以了，丢弃无用的列属性"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 前9列：event_id, user_id, start_time, city, state, zip, country, lat,lng不需要进行聚类\n",
    "columnsToDrop=[\"event_id\", \"user_id\", \"start_time\", \"city\", \"state\", \"zip\", \"country\", \"lat\",\"lng\"]\n",
    "\n",
    "# 获得聚类分析的特征\n",
    "x_data = eventData.drop(columns=columnsToDrop)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "从 10类到100类进行搜索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （5） CH_scores 计算和结果图形化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "K-means begin with clusters: 10\n",
      "CH_score: 0.380115322519, time elaps:7\n",
      "K-means begin with clusters: 20\n",
      "CH_score: 0.208295795365, time elaps:7\n",
      "K-means begin with clusters: 30\n",
      "CH_score: 0.183465094578, time elaps:6\n",
      "K-means begin with clusters: 40\n",
      "CH_score: 0.123685139095, time elaps:6\n",
      "K-means begin with clusters: 50\n",
      "CH_score: 0.141617751312, time elaps:6\n",
      "K-means begin with clusters: 60\n",
      "CH_score: 0.139340149863, time elaps:6\n",
      "K-means begin with clusters: 70\n",
      "CH_score: 0.113303715925, time elaps:6\n",
      "K-means begin with clusters: 80\n",
      "CH_score: 0.0748831198644, time elaps:6\n",
      "K-means begin with clusters: 100\n",
      "CH_score: 0.075013356172, time elaps:7\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x10238ef0>]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHdhJREFUeJzt3XmUVNW59/Hv090IAnqF0IphsNGLvLYigyUaZ3Fg7AKvGiEOxPjGJFdiIlFjoveyXryJxlmXJMrK4FVDEDWRSeWi4kAISCMyS2hBBXFoBUUZpXneP3ZxKdqGLrqr+1TX+X3WqlV1Tp1T9VgefnV61977mLsjIiLxUBB1ASIi0ngU+iIiMaLQFxGJEYW+iEiMKPRFRGJEoS8iEiMKfRGRGFHoi4jE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r4+kiIjYGZnAde7+2AzO5Jw5t8WWABc5u7boqyvsZhZT+D3wAHAKuBKwslWLI8NM/t/wCWEXm8LgP9LaKeOxfFhZn8BziLMpvkRMBp4hhqOh9QX44OE3j6bgSvdvbzeNSj0RUTiQ807IiIxotAXEYkRhb6ISIwo9EVEYkShLyISIwp9EZEYUeiLiMSIQl9EJEb+P9ndGUSMfHM1AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x667bef0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置超参数（聚类数目K）搜索范围\n",
    "Ks = [10,20,30,40,50,60,70,80,100]\n",
    "CH_scores = []\n",
    "for K in Ks:\n",
    "    ch= K_cluster_analysis(K, x_data)\n",
    "    CH_scores.append(ch)\n",
    "\n",
    "plt.plot(Ks, np.array(CH_scores), 'b-')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### （6） 寻找最有分类，并且算出分数，可视化结果"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出在10类的时候 CH_scores 是最高的,而且有可能小于10类，得分更高。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "K-means begin with clusters: 2\n",
      "CH_score: 0.722915539464, time elaps:8\n",
      "K-means begin with clusters: 3\n",
      "CH_score: 0.568211626484, time elaps:8\n",
      "K-means begin with clusters: 4\n",
      "CH_score: 0.529684584067, time elaps:7\n",
      "K-means begin with clusters: 5\n",
      "CH_score: 0.505592733541, time elaps:7\n",
      "K-means begin with clusters: 6\n",
      "CH_score: 0.507898483515, time elaps:7\n",
      "K-means begin with clusters: 7\n",
      "CH_score: 0.476487003848, time elaps:8\n",
      "K-means begin with clusters: 8\n",
      "CH_score: 0.468632911543, time elaps:7\n",
      "K-means begin with clusters: 9\n",
      "CH_score: 0.419917820182, time elaps:7\n",
      "K-means begin with clusters: 10\n",
      "CH_score: 0.40353360473, time elaps:7\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x105b4da0>]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl8VOW9x/HPL4GAil7BRKGsQUHEjSVSFWhVBOHqBXEruAFV0nsrtasWe2u10N6XtLXaxdarqKCoFHEBrYKg4o43QZQdRcAScYmAWiqy/u4fz4mMIZBJmORMZr7v12temTlzzswvvPR7Tp7nPM9j7o6IiGSHnLgLEBGR+qPQFxHJIgp9EZEsotAXEckiCn0RkSyi0BcRySIKfRGRLKLQFxHJIgp9EZEs0ijuAirLz8/3Dh06xF2GiEiDsmDBgo/dvaC6/dIu9Dt06EBpaWncZYiINChm9m4y+6l5R0Qkiyj0RUSyiEJfRCSLKPRFRLKIQl9EJIso9EVEsohCX0Qki2RM6G/cCDfeCEuWxF2JiEj6ypjQd4ebboLbb4+7EhGR9JUxoX/YYXDBBTBlCnz+edzViIikp4wJfYDiYvj0U3joobgrERFJTxkV+n37wtFHwx13xF2JiEh6yqjQN4PRo+GVV2Dp0rirERFJPxkV+gAjRkBeHtx5Z9yViIikn4wL/fx8GDoU7r0XtmyJuxoRkfSScaEPoUN30yZ4+OG4KxERSS8ZGfqnnQZHHaUOXRGRyjIy9HNyQofuiy/CihVxVyMikj4yMvQhdOg2aqQOXRGRREmFvpkNNLOVZrbKzMZW8f4tZvZG9HjLzD5JeG+Emb0dPUaksvh9OeIIOPdcmDwZtm6tr28VEUlv1Ya+meUCtwGDgK7AcDPr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BLc0JV6yFwNeAg8zs0nirAndfDkwA5gCzgDcJTcNZJWNC38waEwL/fnd/JO56KouaA+axZxteHHoDg6PlLacCZ5jZlHhLCtx9ffTzI0LbdK94KwLCsp9lCX+lTSecBNLJIOB1d/8w7kKAM4E17l7u7tuBR4BTY64JAHe/y917uPs3CE0rb8ddUyUfmlkrgOjnR6n+gowIfTMzQnvrcnf/fdz1VDCzAjM7NHp+AOF/hhXxVgXufp27t4mWtxwGPOvusV+JmdlBZnZwxXNgAOFP8li5+wfAOjM7OtrUj7AaXDoZTho07UT+AZxsZgdG/2/2I006vs3s8OhnO+A80uffrMJMYET0fAQwI9VfUO1yiQ1Eb+AyYHHUfg7wM3d/MsaaAFoBk80sl3CCnebuaXN7ZBo6Ang05ASNgAfcfVa8JX3pe8A/JE07AAAAgklEQVT9UTPKamBUzPV8KWqf7g98J+5aANz9NTObDrxOaD5ZSPqMgH3YzA4DthOWb90UVyFm9iBwGpBvZmXADcBNwDQzu4Jw8rww5d+rEbkiItkjI5p3REQkOQp9EZEsotAXEckiCn0RkSyi0BcRySIKfRGRLKLQFxHJIgp9EZEs8v/afObfsyyTNgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xc611518>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置超参数（聚类数目K）搜索范围\n",
    "Ksnew = [2,3,4,5,6,7,8,9,10]\n",
    "CH_scores_new = []\n",
    "for K1 in Ksnew:\n",
    "    ch= K_cluster_analysis(K1, x_data)\n",
    "    CH_scores_new.append(ch)\n",
    "\n",
    "plt.plot(Ksnew, np.array(CH_scores_new), 'b-')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看出在2类的时候 CH_scores 是最高的。所以分为量两类是最优解"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD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ib.figure.Figure at 0xc909630>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x_data_ndarray = np.array(x_data)\n",
    "\n",
    "#显示聚类结果\n",
    "#画出聚类结果，每一类用一种颜色\n",
    "colors = ['b','g']\n",
    "\n",
    "n_clusters = 2\n",
    "mb_kmeans = MiniBatchKMeans(n_clusters = n_clusters)\n",
    "mb_kmeans.fit(x_data_ndarray)\n",
    "\n",
    "y_train_pred = mb_kmeans.labels_\n",
    "cents = mb_kmeans.cluster_centers_#质心\n",
    "\n",
    "for i in range(n_clusters):\n",
    "    index = np.nonzero(y_train_pred==i)[0]\n",
    "    x1 = x_data_ndarray[index,0]\n",
    "    x2 = x_data_ndarray[index,1]\n",
    "    for j in range(len(x1)):\n",
    "        if j < 70:  #每类打印20个\n",
    "            plt.text(x1[j],x2[j],'event',color=colors[i],fontdict={'weight': 'bold', 'size': 9})\n",
    "\n",
    "plt.axis([-10,40,-10,40])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "两类中还有一些数据交织在一起，可能是取值过少的缘故，不过可以看整体的趋势是 1类存在于 0-10 0-10 的界限中。另一类比较散。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
